const mongoose = require('mongoose')

function connect(){
    console.log('开始准备链接数据库')
    mongoose.connect('mongodb+srv://dbroot:dbroot@cluster0-0b0wl.mongodb.net/test?retryWrites=true', {useNewUrlParser: true})
    .then(()=>{
        console.log('mongodb connected.');
    })
    .catch((error)=>{
        console.error.bind(console, 'connection error:')
    });
    console.log("??")

}


exports.connect = connect;
